import java.util.Scanner;

public class test2 {
    static Scanner sc = new Scanner(System.in);
    static int x = sc.nextInt();
    static int y = sc.nextInt();
    static int a,b;

    public static int gcd(int a,int b){
        if(a<0||b<0){
            return -1;
        }
        if (b==0){
            return a;
        }
        return a%b==0?b:gcd(b,a%b);
    }

    public static void main(String[] args) {
        a =gcd(x,y);
        System.out.println("最大公约数："+a);
    }
}
